<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>
  <xsl:variable name="namespace" select="'Microsoft.Services.TestTools.UITesting.Html.'"/>
  <xsl:template match="doc">
    <html>
      <head></head>
      <body>
        <h1>! <xsl:value-of select="$namespace"/></h1>
        <h2>!! Types </h2>
        <p>
        <xsl:for-each select="members/member">
          <xsl:if test="starts-with(@name,'T:')">
              * [<xsl:value-of select="substring-after(@name,$namespace)"/>|#<xsl:value-of select="substring-after(@name,$namespace)"/>]<br/>
          </xsl:if>
        </xsl:for-each>
    	</p>
        <xsl:for-each select="members/member">
          <xsl:if test="starts-with(@name,'T:')">
            <h2>
              !! <xsl:value-of select="substring-after(@name,$namespace)"/> {anchor:<xsl:value-of select="substring-after(@name,$namespace)"/>}
            </h2>
          </xsl:if>
          <xsl:if test="starts-with(@name,'M:')">
            <h3>
              !!! <xsl:value-of select="substring-after(@name,$namespace)"/>
            </h3>
          </xsl:if>
          <xsl:if test="starts-with(@name,'P:')">
            <h3>
              !!! <xsl:value-of select="substring-after(@name,$namespace)"/>
            </h3>
          </xsl:if>
          <xsl:if test="starts-with(@name,'F:')">
            <h3>
              !!! <xsl:value-of select="substring-after(@name,$namespace)"/>
            </h3>
          </xsl:if>
          <p>
            <xsl:apply-templates select="summary | see | example"/>
            <xsl:for-each select="remarks">
				<xsl:if test="position() = 1">
			    	<h4>
			    		!!!! Remarks
			    	</h4>
				</xsl:if>
				<xsl:apply-templates select="."/>
            </xsl:for-each>
            <xsl:for-each select="seealso">
				<xsl:if test="position() = 1">
			    	<h4>
			    		!!!! See also
			    	</h4>
				</xsl:if>
				<xsl:apply-templates select="."/>
            </xsl:for-each>
          </p>
        </xsl:for-each>
      </body>
    </html>
      </xsl:template>
  <xsl:template match="see">
    <code>
      {{<xsl:value-of select="substring-after(@cref,':')"/>}}
    </code>
  </xsl:template>
  <xsl:template match="seealso">
    <code>
      {{<xsl:value-of select="substring-after(@cref,':')"/>}}<br/>
    </code>
  </xsl:template>
  <xsl:template match="example">
    <xsl:value-of select="example"/>
    <code>
      <pre>
{{
<xsl:value-of select="code"/>
}}
      </pre>
    </code>
  </xsl:template>
</xsl:stylesheet>